home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 8.2 KB | 313 lines | [TEXT/MPS ] |
- // UMailer.h
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
-
-
- #ifndef __UMAILER__
- #define __UMAILER__
-
- #if qPowerTalk
-
- // MacApp
-
- #ifndef __UOBJECT__
- #include "UObject.h"
- #endif
-
- #ifndef __USCRIPTABLEOBJECT__
- #include "UScriptableObject.h"
- #endif
-
- // Toolbox
-
- #ifndef __OCESTANDARDMAIL__
- #include <OCEStandardMail.h>
- #endif
-
- class MMailable;
- class TAppleEvent;
- class TDocument;
- class TFileBasedDocument;
- class TLetterTabber;
- class TMailer;
- class TMailerView;
- class TWindow;
-
- //----------------------------------------------------------------------------------------
- // TLetter
- //----------------------------------------------------------------------------------------
-
- // Represents the letter enclosing a document.
- // Contains the mailers, which contain recipients.
-
- class TLetter : public TObject
- {
- MA_DECLARE_CLASS;
-
- public:
- MMailable* fMailDoc; // Enclosed document.
-
- TDocument* fDocument; // Enclosed document.
-
- TLetterTabber *fLetterTabber; // Tabber responsible for the window containing
- // the mailer view
-
- Handle fLetterDescriptor; // Handle to a LetterDescriptor
-
- Boolean fHasMailer; // Does this document have a mailer attached.
-
- Boolean fHasBeenSent; // Has been sent as a letter
-
- Boolean fLetterExists; // Does this document represent an existing letter?
-
- Boolean fReplyToAll; // True if reply to all. False if reply to sender only.
-
- TLetter();
- // Constructor
-
- virtual ~TLetter();
- // Destructor
-
- void ILetter(MMailable* mailDoc);
-
-
- virtual void AddMailer();
- // Add a mailer to this document
-
- virtual void AddNativeMailContent(Boolean& okToSend);
- // Called to put the document's content into the letter in the document's
- // native format.
-
- virtual void AddSnapshotMailContent(Boolean& okToSend);
- // Called to create a snapshot of the document and add this to the letter.
- // Default implementation takes a snapshot of the mailer window.
-
- virtual void AddStandardMailContent(Boolean& okToSend);
- // Called to put the document's content into the letter in the standard mail
- // format.
-
- long CountContainedMailers();
-
- virtual void DeleteMailer();
- // Remove the mailer from this document
-
- virtual void DoAECreateMailer(TAppleEvent* message,
- TAppleEvent* reply);
- // Adds a mailer to this document.
-
- virtual void DoAECreateReply(TAppleEvent* message,
- TAppleEvent* reply);
- // Handles creating a reply mailer in this document.
-
- virtual void DoAESend(TAppleEvent* message,
- TAppleEvent* reply);
- // Handles the send event
-
- virtual void DoForward();
- // Forward this document to a new address.
-
- virtual Boolean DoMailMenuCommand(CommandNumber aCommandNumber);
- // Handles the default menu commands associated with a mailable document.
-
- virtual void DoReply();
- // Create a new document in reply to this one.
-
- virtual void DoSend();
- // Tell this document to send itself.
-
- virtual Boolean ValidateForSend();
- // Validate the contents of the subject and recipient fields before mailing.
-
- virtual Boolean DoSendOptions(Ptr shouldSend,
- Ptr sendOptions,
- CStr255& nativeFormatName);
- // Displays the send options dialog.
-
- virtual void DoSetupMailMenus();
- // Set up the mail menu.
-
- virtual void GetDefaultTag(CStr31& tagString);
- // Get the default tag to show when closing letters.
-
- virtual TMailer* GetIndContainedMailer(short index);
-
- virtual TMailerView* GetMailerView();
- // Returns the TMailerView assocatiated with the letter
-
- virtual TWindow* GetMailerWindow();
- // Returns the document's window that should be used for the mailer.
-
- virtual WindowRef GetMailerWindowRef();
- // Returns the toolbox window that should be used for the mailer.
-
- virtual Boolean HasMailer();
- // Does this letter have a mailer attached?
-
- virtual void LetterContentChanged();
- // Tells the SMP that the document contents have changed.
-
- virtual void MakeRoomForMailer(long amount, Boolean redraw);
- // Adjust the views to make room for the mailer
-
- virtual void OpenLetter();
- // Creates a mailer and reads the content from the mail system.
-
- virtual void ReadLetter(Boolean forPrinting);
- // Override to read a letter.
-
- virtual Boolean ReadNativeMailContent();
- // Called from OpenLetter to read the content in the document's native format.
-
- virtual Boolean ReadSnapshotMailContent();
- // Called from OpenLetter to read the content in the snapshot format.
-
- virtual Boolean ReadStandardMailContent();
- // Called from OpenLetter to read the content in the standard format.
-
-
- virtual void SaveLetter(CommandNumber itsCommandNumber);
- // Try to save the document to disk as a letter
-
- virtual void SendDocument(Ptr theSendOptions,
- unsigned long whichFormats,
- CStr255& nativeFormatName);
- // Sends the document.
-
- virtual void SetLetterDesc(Handle theDesc);
- // Associated this document with a LetterSpecifier. Called from
- // TApplication::OpenOldLetters and TFileBasedDocument::ReadLetter when
- // opening letters from the mail and file systems.
-
-
- };
-
- //----------------------------------------------------------------------------------------
- // TFileBasedLetter
- //----------------------------------------------------------------------------------------
-
- // Represents the letter enclosing a file-based document.
-
- class TFileBasedLetter : public TLetter
- {
- MA_DECLARE_CLASS;
-
- public:
- TFileBasedDocument* fFileBasedDocument; // Enclosed document.
-
- TFileBasedLetter();
- // Constructor
-
- virtual ~TFileBasedLetter();
- // Destructor
-
- void IFileBasedLetter(MMailable* mailDoc);
-
- virtual void AddNativeMailContent(Boolean& okToSend); // override
- // Saves the document in a temporary file then adds it as the main enclosure to
- // the letter.
-
- virtual void ReadLetter(Boolean forPrinting); // override
- // Called to read an existing letter from HFS for display or printing.
-
- virtual Boolean ReadNativeMailContent(); // override
- // Reads the document from the mail enclosure file in the letter.
-
- virtual void SaveLetter(CommandNumber itsCommandNumber); // override
- // Try to save the document to disk as a letter.
-
- };
-
- //----------------------------------------------------------------------------------------
- // TMailer
- //----------------------------------------------------------------------------------------
-
- // OSL Accessor class for one of the mailers attached to a document.
-
- class TMailer : public TObject,
- public MScriptableObject
- {
- MA_DECLARE_CLASS;
-
- public:
- WindowRef fWindow;
- TDocument* fDocument;
- TLetter* fLetter;
- short fWhichMailer;
-
- TMailer();
- virtual ~TMailer();
- // Destructor
-
- void IMailer(TLetter* letter,
- WindowRef theWindow,
- short whichMailer);
-
- Boolean TopMailer();
-
- virtual MScriptableObject* GetObjectsContainer();
-
- virtual Boolean GetObjectProperty(CAEDesc& thePropertyValue,
- DescType whichProperty,
- const CAEDesc& desiredType);
-
- virtual void SetObjectProperty(const CAEDesc& thePropertyValue,
- DescType whichProperty);
-
- virtual MScriptableObject* GetIndContainedObject(DescType desiredType,
- long index);
-
- virtual long CountContainedObjects(DescType desiredType);
-
- virtual void DoAEDelete(TAppleEvent* message,
- TAppleEvent* reply);
- };
-
- //----------------------------------------------------------------------------------------
- // TRecipient
- //----------------------------------------------------------------------------------------
-
- // OSL Accessor class for one of the recipients in a mailer.
-
- class TRecipient : public TObject,
- public MScriptableObject
- {
-
- MA_DECLARE_CLASS;
-
- public:
- WindowRef fWindow;
- TMailer* fMailer;
- long fWhichRecipient;
-
- TRecipient();
- virtual ~TRecipient();
- // Destructor
-
- void IRecipient(TMailer* theMailer,
- long index,
- WindowRef theWindow);
-
- virtual MScriptableObject* GetObjectsContainer();
-
- virtual Boolean GetObjectProperty(CAEDesc& thePropertyValue,
- DescType whichProperty,
- const CAEDesc& desiredType);
-
- void SetObjectProperty(const CAEDesc& thePropertyValue,
- DescType whichProperty);
-
-
- };
-
- //----------------------------------------------------------------------------------------
-
- // Globals for this unit
-
- extern void InitUMailer();
- // Sets up proc pointers and does general initialization
-
- extern SMPDrawImageUPP gMacAppImageProc;
-
- #endif // qPowerTalk
-
- #endif // __UMAILER__
-